/**
 * 项目名：	Rumba Plan
 * 
 * 版权所有(C)，上海海鼎信息工程股份有限公司，2006，所有权利保留。
 * 
 * 文件名：	Prompt.java
 * 模块说明：	
 * 修改历史：
 * 2006-11-14 - lxm - 创建。
 */
package com.hd123.rumba.prompt;

import java.util.Date;

import com.hd123.rumba.exception.StringTooLongException;
import com.hd123.rumba.runtime.BaseEntity;
import com.hd123.rumba.user.IRole;
import com.hd123.rumba.user.IUser;

/**
 * 提示信息 | 实体 | 实现类
 * 
 * @author lxm
 * 
 */
public class Prompt extends BaseEntity implements IPrompt {

  private IUser receiverUser;
  private IRole receiverRole;
  private String senderId;
  private String senderClassName;
  private Integer level;
  private String message;
  private String text = "";
  private String flag;
  private Date time = new Date();
  private String link;
  private String linkPerm;

  public Integer getLevel() {
    return level;
  }

  public void setLevel(Integer level) {
    this.level = level;
  }

  public String getLink() {
    return link;
  }

  public void setLink(String link) throws StringTooLongException {
    if (link != null)
      link = truncate(link, CPrompt.LENGTH_LINK, "link", CPrompt.CAPTION_LINK);
    this.link = link;
  }

  public String getMessage() {
    return message;
  }

  public void setMessage(String message) throws StringTooLongException {
    if (message != null)
      message = truncate(message, CPrompt.LENGTH_MESSAGE, "message", CPrompt.CAPTION_MESSAGE);
    this.message = message;
  }

  public IRole getReceiverRole() {
    return receiverRole;
  }

  public void setReceiverRole(IRole receiverRole) {
    this.receiverRole = receiverRole;
  }

  public IUser getReceiverUser() {
    return receiverUser;
  }

  public void setReceiverUser(IUser receiverUser) {
    this.receiverUser = receiverUser;
  }

  public String getSenderId() {
    return senderId;
  }

  public void setSenderId(String senderId) throws StringTooLongException {
    if (senderId != null)
      senderId = truncate(senderId, CPrompt.LENGTH_SENDERID, "senderId", CPrompt.CAPTION_SENDERID);
    this.senderId = senderId;
  }

  public String getFlag() {
    return flag;
  }

  public void setFlag(String flag) throws StringTooLongException {
    if (flag != null)
      flag = truncate(flag, CPrompt.LENGTH_FLAG, "flag", CPrompt.CAPTION_FLAG);
    this.flag = flag;
  }

  public String getLinkPerm() {
    return linkPerm;
  }

  public void setLinkPerm(String linkPerm) throws StringTooLongException {
    if (linkPerm != null)
      linkPerm = truncate(linkPerm, CPrompt.LENGTH_LINKPERM, "linkPerm", CPrompt.CAPTION_LINKPERM);
    this.linkPerm = linkPerm;
  }

  public String getSenderClassName() {
    return senderClassName;
  }

  public void setSenderClassName(String senderClassName) throws StringTooLongException {
    if (senderClassName != null)
      senderClassName = truncate(senderClassName, CPrompt.LENGTH_SENDERCLASSNAME,
          "senderClassName", CPrompt.CAPTION_SENDERCLASSNAME);
    this.senderClassName = senderClassName;
  }

  public String getText() {
    return text;
  }

  public void setText(String text) {
    this.text = text == null ? "" : text;
  }

  public Date getTime() {
    return time;
  }

  public void setTime(Date time) {
    this.time = time;
  }

}
